package com.xintoucloud.pbs.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xintoucloud.pbs.dao.JoinMeetingInformationDao;
import com.xintoucloud.pbs.entity.JoinMeetingInformation;
import com.xintoucloud.pbs.model.JmiDto;
import com.xintoucloud.pbs.service.DevelopMemberService;
import com.xintoucloud.pbs.service.JoinMeetingInformationService;
import com.xintoucloud.pbs.service.MeetingTypeService;
@Service@Transactional
public class JoinMeetingInformationServiceImpl implements JoinMeetingInformationService{
    @Autowired
	private JoinMeetingInformationDao joinMeetingInformationDao;
    
    @Autowired
    private DevelopMemberService developMemberService;
    
    @Autowired
    private MeetingTypeService meetingTypeService;
    
	@Override
	public boolean save(JmiDto jmidto) {
		JoinMeetingInformation jmi = new JoinMeetingInformation();
		
		jmi.setCreateTime(jmidto.getCreateTime());
		jmi.setMeetingTime(jmidto.getMeetingTime());
		jmi.setShouldNum(jmidto.getShouldNum());
		jmi.setRealNum(jmidto.getRealNum());
		jmi.setMeetingResult(jmidto.getMeetingResult());
		jmi.setFirstRecommended(jmidto.getFirstRecommended());
		jmi.setFirstRecPosition(jmidto.getFirstRecPosition());
		jmi.setSecondRecommended(jmidto.getSecondRecommended());
		jmi.setSecondRecPosition(jmidto.getSecondRecPosition());
		jmi.setMeetingNum(jmidto.getMeetingNum());
		jmi.setDm(developMemberService.getOne(jmidto.getBid()));
		jmi.setMtype(meetingTypeService.getOne(jmidto.getMtid()));
		
		return joinMeetingInformationDao.save(jmi)!=null;
	}

	@Override
	public void delete(Integer jmid) {
		joinMeetingInformationDao.delete(jmid);
	}

}
